package com.si.sea_island.utils;

public class TokenUtils {

    /**
     * 生成Token
     *
     * @return
     */
    public static String makeToken() {
        StringBuilder random_pwd = new StringBuilder();
        String strAll = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
        for (int i = 0; i < 24; i++) {
            int f = (int) (Math.random()*62);
            random_pwd.append(strAll.charAt(f));
        }
        return random_pwd.toString();
    }

    public static String makeToken(int number) {
        StringBuilder random_pwd = new StringBuilder();
        String strAll = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
        for (int i = 0; i < number; i++) {
            int f = (int) (Math.random()*62);
            random_pwd.append(strAll.charAt(f));
        }
        return random_pwd.toString();
    }

    public static String makeNumberToken(int num) {
        StringBuilder random_pwd = new StringBuilder();
        String strAll = "0123456789";
        for (int i = 0; i < num; i++) {
            int f = (int) (Math.random()*10);
            random_pwd.append(strAll.charAt(f));
        }
        return random_pwd.toString();
    }
}
